﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Xml.Linq;

namespace OntologyWPFSilverlight.Widget
{
    public class ComboBox : Canvas
    {
        private System.Windows.Controls.ComboBox myComboBox = null;
        private TextBlock label = null;

        public ComboBox()
        {
            Build();
        }

        private void Build()
        {
            StackPanel stackPanel = new StackPanel();
            myComboBox = new System.Windows.Controls.ComboBox();
            label = new TextBlock();
            stackPanel.Children.Add(label);
            stackPanel.Children.Add(myComboBox);
            this.Children.Add(stackPanel);
        }

        public void AddItem(IEnumerable<XElement> nodes)
        {
            foreach (XElement node in nodes) 
            {
                myComboBox.Items.Add(node.Attribute("Name").Value);
            }
        }

        public void AddLabel(string text) 
        {
            label.Text = text;
        }
    }
}
